/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Clases;

import java.util.LinkedList;
import java.util.List;
import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;

/**
 *
 * @author TVD
 */
public class ModeloCategorias implements ComboBoxModel{
private List<Categoria> mCategorias;
private ListDataListener l ;
private Categoria seleccionado;
    public ModeloCategorias(LinkedList <Categoria> l) {
        mCategorias = l;
        
    }

    @Override
    public void setSelectedItem(Object anItem) {
         seleccionado = (Categoria)anItem;
    }

    @Override
    public Object getSelectedItem() {
        return seleccionado;
    }

    @Override
    public int getSize() {
        return mCategorias.size();
    }

    @Override
    public Object getElementAt(int index) {
       return mCategorias.get(index);
    }

    @Override
    public void addListDataListener(ListDataListener l) {
        this.l = l;
    }

    @Override
    public void removeListDataListener(ListDataListener l) {
        this.l=l;
    }
    public void removeFirst()
    {
        mCategorias.remove(0);
    
    }
    
}
